<?php
$dis_id=3;
include("../../inc/conn.inc");
include("../islogin2.php");
$check_rs=mysql_query("select id,m_type,m_jifen from member where id=".$_COOKIE['user_id']);
$check_row=mysql_fetch_array($check_rs);
if($check_row["m_type"]==6)
{
	$huiyuan=1;
}

if($_POST[act_t2j]=="sdi2012")
{
    $_POST["p_info"]=delwords($_POST["p_info"]);
    $_POST["p_title"]=delwords($_POST["p_title"]);
    $_POST["p_keyword"]=delwords($_POST["p_keyword"]);
	$_POST["p_info"]=delelse($_POST["p_info"]);
    $_POST["p_title"]=delelse($_POST["p_title"]);
	$_POST["p_xinghao"]=delelse($_POST["p_xinghao"]);
	$_POST["p_guige"]=delelse($_POST["p_guige"]);
	$_POST["p_cailiao"]=delelse($_POST["p_cailiao"]);
	$_POST["p_changdi"]=delelse($_POST["p_changdi"]);
	$_POST["p_renzheng"]=delelse($_POST["p_renzheng"]);
	
    $n_rs2=@mysql_query("select count(id) from product where member_id=".$_COOKIE['user_id']);
    $num=@mysql_result($n_rs2,0);
    @mysql_free_result($n_rs2);
    if($check_row[m_type]==3)
    {
	   if($num>9)
	   {  
	      if($check_row[m_jifen]>2)
		  {
			 $jifen=$check_row[m_jifen]-2;
			 @mysql_query("update member set m_jifen='$jifen' where id=".$_COOKIE['user_id']);
			 @mysql_query("insert into jifen (member_id,j_type,j_num,j_name,add_time) values ('".$_COOKIE['user_id']."','1','2','发布产品扣除2个三帝币','".date("Y-m-d H:i:s")."')");
			 $c_rs_1=mysql_query("select id,p_num,cat_name from catalog where id='$_POST[catalog_1]'");
			 $c_row_1=mysql_fetch_array($c_rs_1);
			 $c_rs_2=mysql_query("select id,p_num,cat_name from catalog where id='$_POST[catalog_2]'");
			 $c_row_2=mysql_fetch_array($c_rs_2);
			 $c_rs_3=mysql_query("select id,p_num,cat_name from catalog where id='$_POST[catalog_3]'");
			 $c_row_3=mysql_fetch_array($c_rs_3);
			 $p_list_id=explode("@",$_POST[p_list]);
			 $catalog_1=($_POST[catalog_1])?$_POST[catalog_1]:0;
			 $catalog_2=($_POST[catalog_2])?$_POST[catalog_2]:0;
			 $catalog_3=($_POST[catalog_3])?$_POST[catalog_3]:0;
			 if($c_row_1[id]){
			 $p_num=$c_row_1[p_num]+1;
			 mysql_query("update catalog set p_num='$p_num' where id='$c_row_1[id]'");
		}
		if($c_row_2[id])
		{
			$p_num=$c_row_2[p_num]+1;
			mysql_query("update catalog set p_num='$p_num' where id='$c_row_2[id]'");
		}
		if($c_row_3[id])
		{
			$p_num=$c_row_3[p_num]+1;
			mysql_query("update catalog set p_num='$p_num' where id='$c_row_3[id]'");
		}

	    @mysql_query("insert into product (member_id,p_type,p_title,catalog_id1,catalog_1,catalog_id2,catalog_2,catalog_id3,catalog_3,p_list_id,p_list,p_keyword,p_info,picture,p_pinpai,p_xinghao,p_guige,p_price,p_baozhuang,p_shuliang,p_cailiao,p_changdi,p_jhtime,p_renzheng,p_crz,p_minorder,p_paytype,p_addtime,m_type) values ('".$_COOKIE['user_id']."','1','$_POST[p_title]','$catalog_1','$c_row_1[cat_name]','$catalog_2','$c_row_2[cat_name]','$catalog_3','$c_row_3[cat_name]','$p_list_id[0]','$p_list_id[1]','$_POST[p_keyword]','$_POST[p_info]','$_POST[picture]','$_POST[p_pinpai]','$_POST[p_xinghao]','$_POST[p_guige]','$_POST[p_price]$_POST[p_price2]','$_POST[p_baozhuang]','$_POST[p_shuliang]$_POST[p_shuliang2]','$_POST[p_cailiao]','$_POST[p_changdi]','$_POST[p_jhtime]','$_POST[p_renzheng]','$_POST[p_crz]','$_POST[p_minorder]$_POST[p_minorder2]','$_POST[p_paytype]','".date("Y-m-d H:i:s")."','$check_row[m_type]')");
		
		echo "<script>alert('添加成功');location='index.php';</script>";		 
	}
	else
	 {
		 
		 echo "<script>alert('您的三帝币不足，请充值三帝币');location='index.php';</script>";
	 } 
	  }
	  else
	  {
	  
	     $c_rs_1=mysql_query("select id,p_num,cat_name from catalog where id='$_POST[catalog_1]'");
	     $c_row_1=mysql_fetch_array($c_rs_1);
	     $c_rs_2=mysql_query("select id,p_num,cat_name from catalog where id='$_POST[catalog_2]'");
	     $c_row_2=mysql_fetch_array($c_rs_2);
	     $c_rs_3=mysql_query("select id,p_num,cat_name from catalog where id='$_POST[catalog_3]'");
	     $c_row_3=mysql_fetch_array($c_rs_3); 
			if($c_row_1[id]){
			$p_num=$c_row_1[p_num]+1;
			mysql_query("update catalog set p_num='$p_num' where id='$c_row_1[id]'");
			}
			if($c_row_2[id])
			{
			$p_num=$c_row_2[p_num]+1;
			mysql_query("update catalog set p_num='$p_num' where id='$c_row_2[id]'");
			}
			if($c_row_3[id])
			{
			$p_num=$c_row_3[p_num]+1;
			mysql_query("update catalog set p_num='$p_num' where id='$c_row_3[id]'");
			}
	     $p_list_id=explode("@",$_POST[p_list]);
	     $catalog_1=($_POST[catalog_1])?$_POST[catalog_1]:0;
	     $catalog_2=($_POST[catalog_2])?$_POST[catalog_2]:0;
	     $catalog_3=($_POST[catalog_3])?$_POST[catalog_3]:0;

	     @mysql_query("insert into product (member_id,p_type,p_title,catalog_id1,catalog_1,catalog_id2,catalog_2,catalog_id3,catalog_3,p_list_id,p_list,p_keyword,p_info,picture,p_pinpai,p_xinghao,p_guige,p_price,p_baozhuang,p_shuliang,p_cailiao,p_changdi,p_jhtime,p_renzheng,p_crz,p_minorder,p_paytype,p_addtime,m_type) values ('".$_COOKIE['user_id']."','1','$_POST[p_title]','$catalog_1','$c_row_1[cat_name]','$catalog_2','$c_row_2[cat_name]','$catalog_3','$c_row_3[cat_name]','$p_list_id[0]','$p_list_id[1]','$_POST[p_keyword]','$_POST[p_info]','$_POST[picture]','$_POST[p_pinpai]','$_POST[p_xinghao]','$_POST[p_guige]','$_POST[p_price]$_POST[p_price2]','$_POST[p_baozhuang]','$_POST[p_shuliang]$_POST[p_shuliang2]','$_POST[p_cailiao]','$_POST[p_changdi]','$_POST[p_jhtime]','$_POST[p_renzheng]','$_POST[p_crz]','$_POST[p_minorder]$_POST[p_minorder2]','$_POST[p_paytype]','".date("Y-m-d H:i:s")."','$check_row[m_type]')");
		 
		 
		 
         
	     echo "<script>alert('添加成功');location='index.php';</script>";
	  
	  
	  }
   
   
   
   
   
   }
else
{

$c_rs_1=mysql_query("select * from catalog where id='$_POST[catalog_1]'");
$c_row_1=mysql_fetch_array($c_rs_1);

$c_rs_2=mysql_query("select * from catalog where id='$_POST[catalog_2]'");
$c_row_2=mysql_fetch_array($c_rs_2);

$c_rs_3=mysql_query("select * from catalog where id='$_POST[catalog_3]'");
$c_row_3=mysql_fetch_array($c_rs_3);

if($c_row_1[id]){
$p_num=$c_row_1[p_num]+1;
mysql_query("update catalog set p_num='$p_num' where id='$c_row_1[id]'");
}
if($c_row_2[id]){
$p_num=$c_row_2[p_num]+1;
mysql_query("update catalog set p_num='$p_num' where id='$c_row_2[id]'");
}
if($c_row_3[id]){
$p_num=$c_row_3[p_num]+1;
mysql_query("update catalog set p_num='$p_num' where id='$c_row_3[id]'");
}


$p_list_id=explode("@",$_POST[p_list]);
$catalog_1=($_POST[catalog_1])?$_POST[catalog_1]:0;
$catalog_2=($_POST[catalog_2])?$_POST[catalog_2]:0;
$catalog_3=($_POST[catalog_3])?$_POST[catalog_3]:0;

@mysql_query("insert into product (member_id,p_type,p_title,catalog_id1,catalog_1,catalog_id2,catalog_2,catalog_id3,catalog_3,p_list_id,p_list,p_keyword,p_info,picture,p_pinpai,p_xinghao,p_guige,p_price,p_baozhuang,p_shuliang,p_cailiao,p_changdi,p_jhtime,p_renzheng,p_crz,p_minorder,p_paytype,p_addtime,m_type) values ('".$_COOKIE['user_id']."','1','$_POST[p_title]','$catalog_1','$c_row_1[cat_name]','$catalog_2','$c_row_2[cat_name]','$catalog_3','$c_row_3[cat_name]','$p_list_id[0]','$p_list_id[1]','$_POST[p_keyword]','$_POST[p_info]','$_POST[picture]','$_POST[p_pinpai]','$_POST[p_xinghao]','$_POST[p_guige]','$_POST[p_price]$_POST[p_price2]','$_POST[p_baozhuang]','$_POST[p_shuliang]$_POST[p_shuliang2]','$_POST[p_cailiao]','$_POST[p_changdi]','$_POST[p_jhtime]','$_POST[p_renzheng]','$_POST[p_crz]','$_POST[p_minorder]$_POST[p_minorder2]','$_POST[p_paytype]','".date("Y-m-d H:i:s")."','$check_row[m_type]')");

$lid = mysql_query("select LAST_INSERT_ID() as lid");
$lid2 = mysql_fetch_array($lid);
$lid = $lid2["lid"];
echo $lid;

$z1_arr=array(0=>0,1=>"时尚礼品、饰品",2=>"宠物与婴儿用品及玩具",3=>"纺织、服饰",4=>"农业",5=>"广告、办公、包装用品",6=>"家居与园艺",7=>"家具装饰",8=>"建筑、装修、装潢",9=>"医疗健康",10=>"体育休闲用品",11=>"计算机及消费电子",12=>"电子电工",13=>"机械设备、五金工具",14=>"交通运输及配件",15=>"化工、矿产");
//$z1=mysql_query("select * from hot_product where id='".$_POST["zuanshi1"]."'");
//$z1_row=mysql_fetch_array($z1);
$z1_row["hot_name"]=$z1_arr[$_POST["zuanshi1"]];

$z2=mysql_query("select * from hot_product where id='".$_POST["zuanshi2"]."'");
$z2_row=mysql_fetch_array($z2);

$z3=mysql_query("select * from hot_product where id='".$_POST["zuanshi3"]."'");
$z3_row=mysql_fetch_array($z3);

$z_sql = "insert into hot_pro_list(id,member_id,p_title,catalog_id1,catalog_1,catalog_id2,catalog_2,catalog_id3,catalog_3,p_addtime,picture,m_type) values ('".$lid."','".$_COOKIE["user_id"]."','".$_POST["p_title"]."','".$_POST["zuanshi1"]."','".$z1_row["hot_name"]."','".$_POST["zuanshi2"]."','".$z2_row["hot_name"]."','".$_POST["zuanshi3"]."','".$z3_row["hot_name"]."','".date("Y-m-d H:i:s")."','".$_POST["picture"]."',6)";
echo $z_sql;
mysql_query($z_sql);


echo "<script>alert('添加成功');location='index.php';</script>";
    }

}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/left.js" charset="gb2312"></script>
<script type="text/javascript" src="../js/catalog.js" charset="gb2312"></script>
<script type="text/javascript" src="../../js/jquery.js"></script>
<body>
<div id="mian">
<?php include("../inc/top.php");?>
<div class="top1"><span>您当前位置：<a href="../index.php" class="dh">会员助手</a> &gt;&gt; 供应信息 &gt;&gt; 产品管理</span></div>
<div class="left">
<?php include("../inc/left.php");?>
</div>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">发布产品信息</TD>
   </TR>
</TABLE>
<br>
<TABLE width="100%" border="0" cellpadding="0" cellSpacing="1" bgcolor="#C1DCF5">
        <TBODY>
        <form method="post" action="" name="form1" id="form1">
          <TR>
            <td width="17%" height="25" align="center" bgcolor="#EFF6FF">产品名称&nbsp;<font color="#FF0000">*</font></td>
            <TD width="83%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_title" id="p_title" type="text" size="50" maxlength="120"><br>
<font color="red">严禁添加电话号码和网址，否则直接删除账号</font></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品目录<span style="padding-left:4px;line-height:35px;">&nbsp;<font color="#FF0000">*</font></span></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;line-height:35px;">

<select name="catalog_1" id="catalog_1" onChange="changelocation(document.form1.catalog_1.options[document.form1.catalog_1.selectedIndex].value)">
 <option value="">--选择大类--</option>   
<?php
$rrs=mysql_query("select id,cat_name from catalog where cat_id=0 order by id asc");    
while($rrow=mysql_fetch_array($rrs)){   
?>     
 <option value="<?=$rrow[id]?>"><?=$rrow[cat_name]?></option><?php }?>
</select>&nbsp;<select name="catalog_2" id="catalog_2" onFocus="changelocation(document.form1.catalog_1.options[document.form1.catalog_1.selectedIndex].value)">
  <option value="">--选择二级分类--</option>
</select>&nbsp;<select name="catalog_3" id="catalog_3" onFocus="changelocation2(document.form1.catalog_2.options[document.form1.catalog_2.selectedIndex].value)">   
  <option value="" selected>--选择三级分类--</option>
</select></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品分类&nbsp;<font color="#FF0000">*</font></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;">
			<?php $p_rs=mysql_query("select id,p_cname from p_list where member_id=".$_COOKIE['user_id']." order by id asc");
			?>
			<select name="p_list" id="p_list">
			   <option value="">--选择产品分类--</option>
			   <?php while($p_row=mysql_fetch_array($p_rs)){?>
			   <option value="<?=$p_row['id']?>@<?=$p_row[p_cname]?>"><?=$p_row[p_cname]?></option>
			   <?php }?>
			</select>&nbsp;&nbsp;<a href="product_group_modify.php?tj=ok">增加新分类</a></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品关键&nbsp;<font color="#FF0000">*</font></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_keyword" id="p_keyword"  type="text" size="60" maxlength="500"></TD>
          </TR>		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品描述&nbsp;<font color="#FF0000">*</font></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><textarea name="p_info" id="p_info" cols="70" rows="15"></textarea>
            <br>
            <font color="#FF0000">警告：</font>请不要添加<font color="#FF0000">公司电话</font>和贵<font color="#FF0000">公司网址</font>，否则我们直接删除该信息。<br></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品图片</td>
            <TD bgcolor="#F9F9F9" style="padding:4px;line-height:30px;"><input name="picture" id="picture" type="text" size="35" maxlength="100">&nbsp;&nbsp;<input name="button" type="button" onClick="window.open ('../upfile.php', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')" value="上传图片">
              (图片限制140*104)<br>
              <input type="button" onClick="window.open ('/member/photo/info.php', 'newwindow', 'height=500, width=600, top=0, left=250, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')" value="选择已上传的图片"></TD>
          </TR>
		  <TR>
            <td height="25" colspan="2" align="left" bgcolor="#EFF6FF"><STRONG>产品属性</STRONG></td>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品品牌</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_pinpai" type="text" size="30" maxlength="6"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品型号</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_xinghao" type="text" size="30" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品规格&nbsp;<font color="#FF0000">*</font></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_guige" type="text" size="30" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品价格</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_price" type="text" size="30" maxlength="5">
              <select name="p_price2">
                <OPTION value="">--请选择--</OPTION>
                <OPTION value="/台">/台</OPTION>
                <OPTION value="/粒">/粒</OPTION>
                <OPTION value="/座">/座</OPTION>
                <OPTION value="/辆">/辆</OPTION>
                <OPTION value="/只">/只</OPTION>
                <OPTION value="/支">/支</OPTION>
                <OPTION value="/枝">/枝</OPTION>
                <OPTION value="/架">/架</OPTION>
                <OPTION value="/头">/头</OPTION>
                <OPTION value="/张">/张</OPTION>
                <OPTION value="/块">/块</OPTION>
                <OPTION value="/片">/片</OPTION>
                <OPTION value="/匹">/匹</OPTION>
                <OPTION value="/件">/件</OPTION>
                <OPTION value="/根">/根</OPTION>
                <OPTION value="/条">/条</OPTION>
                <OPTION value="/把">/把</OPTION>
                <OPTION value="/卷">/卷</OPTION>
                <OPTION value="/副">/副</OPTION>
                <OPTION value="/幅">/幅</OPTION>
                <OPTION value="/双">/双</OPTION>
                <OPTION value="/一打">/一打</OPTION>
                <OPTION value="/份">/份</OPTION>
                <OPTION value="/套">/套</OPTION>
                <OPTION value="/棵">/棵</OPTION>
                <OPTION value="/箱">/箱</OPTION>
                <OPTION value="/袋">/袋</OPTION>
                <OPTION value="/盒">/盒</OPTION>
                <OPTION value="/包">/包</OPTION>
                <OPTION value="/捆">/捆</OPTION>
                <OPTION value="/筐">/筐</OPTION>
                <OPTION value="/瓶（罐）">/瓶（罐）</OPTION>
                <OPTION value="/毫米">/毫米</OPTION>
                <OPTION value="/厘米">/厘米</OPTION>
                <OPTION value="/米">/米</OPTION>
                <OPTION value="/千米">/千米</OPTION>
                <OPTION value="/英寸">/英寸</OPTION>
                <OPTION value="/英尺">/英尺</OPTION>
                <OPTION value="/加仑(英)">/加仑 (英)</OPTION>
                <OPTION value="/加仑(美)">/加仑 (美)</OPTION>
                <OPTION value="/克">/克</OPTION>
                <OPTION value="/千克">/千克</OPTION>
                <OPTION value="/磅">/磅</OPTION>
                <OPTION value="/公吨">/公吨</OPTION>
                <OPTION value="/吨(英)">/吨 (英)</OPTION>
                <OPTION value="/吨(美)">/吨 (美)</OPTION>
                <OPTION value="/毫升">/毫升</OPTION>
                <OPTION value="/公升">/公升</OPTION>
                <OPTION value="/盎司">/盎司</OPTION>
                <OPTION value="/夸脱">/夸脱</OPTION>
                <OPTION value="/品脱(英)">/品脱(英)</OPTION>
                <OPTION value="/品脱(美)">/品脱(美)</OPTION>
                <OPTION value="/码">/码</OPTION>
                <OPTION value="/平方英尺">/平方英尺</OPTION>
                <OPTION value="/平方英寸">/平方英寸</OPTION>
                <OPTION value="/平方米">/平方米</OPTION>
                <OPTION value="/平方码">/平方码</OPTION>
                <OPTION value="/立方米">/立方米</OPTION>
			</SELECT></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品包装</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_baozhuang" type="text" size="30" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品总数量</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_shuliang" type="text" size="30" maxlength="6">
              <select name="p_shuliang2">
                <OPTION value="">--请选择--</OPTION>
                <OPTION value="/台">/台</OPTION>
                <OPTION value="/粒">/粒</OPTION>
                <OPTION value="/座">/座</OPTION>
                <OPTION value="/辆">/辆</OPTION>
                <OPTION value="/只">/只</OPTION>
                <OPTION value="/支">/支</OPTION>
                <OPTION value="/枝">/枝</OPTION>
                <OPTION value="/架">/架</OPTION>
                <OPTION value="/头">/头</OPTION>
                <OPTION value="/张">/张</OPTION>
                <OPTION value="/块">/块</OPTION>
                <OPTION value="/片">/片</OPTION>
                <OPTION value="/匹">/匹</OPTION>
                <OPTION value="/件">/件</OPTION>
                <OPTION value="/根">/根</OPTION>
                <OPTION value="/条">/条</OPTION>
                <OPTION value="/把">/把</OPTION>
                <OPTION value="/卷">/卷</OPTION>
                <OPTION value="/副">/副</OPTION>
                <OPTION value="/幅">/幅</OPTION>
                <OPTION value="/双">/双</OPTION>
                <OPTION value="/一打">/一打</OPTION>
                <OPTION value="/份">/份</OPTION>
                <OPTION value="/套">/套</OPTION>
                <OPTION value="/棵">/棵</OPTION>
                <OPTION value="/箱">/箱</OPTION>
                <OPTION value="/袋">/袋</OPTION>
                <OPTION value="/盒">/盒</OPTION>
                <OPTION value="/包">/包</OPTION>
                <OPTION value="/捆">/捆</OPTION>
                <OPTION value="/筐">/筐</OPTION>
                <OPTION value="/瓶（罐）">/瓶（罐）</OPTION>
                <OPTION value="/毫米">/毫米</OPTION>
                <OPTION value="/厘米">/厘米</OPTION>
                <OPTION value="/米">/米</OPTION>
                <OPTION value="/千米">/千米</OPTION>
                <OPTION value="/英寸">/英寸</OPTION>
                <OPTION value="/英尺">/英尺</OPTION>
                <OPTION value="/加仑(英)">/加仑 (英)</OPTION>
                <OPTION value="/加仑(美)">/加仑 (美)</OPTION>
                <OPTION value="/克">/克</OPTION>
                <OPTION value="/千克">/千克</OPTION>
                <OPTION value="/磅">/磅</OPTION>
                <OPTION value="/公吨">/公吨</OPTION>
                <OPTION value="/吨(英)">/吨 (英)</OPTION>
                <OPTION value="/吨(美)">/吨 (美)</OPTION>
                <OPTION value="/毫升">/毫升</OPTION>
                <OPTION value="/公升">/公升</OPTION>
                <OPTION value="/盎司">/盎司</OPTION>
                <OPTION value="/夸脱">/夸脱</OPTION>
                <OPTION value="/品脱(英)">/品脱(英)</OPTION>
                <OPTION value="/品脱(美)">/品脱(美)</OPTION>
                <OPTION value="/码">/码</OPTION>
                <OPTION value="/平方英尺">/平方英尺</OPTION>
                <OPTION value="/平方英寸">/平方英寸</OPTION>
                <OPTION value="/平方米">/平方米</OPTION>
                <OPTION value="/平方码">/平方码</OPTION>
                <OPTION value="/立方米">/立方米</OPTION>
              </SELECT></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品材料</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_cailiao" type="text" size="30" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品产地</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_changdi" type="text" size="30" maxlength="6"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品交货期</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_jhtime" type="text" size="30" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品认证</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_renzheng"  type="text" size="30" maxlength="15">
            (如:CE认证) </TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">企业认证</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_crz" type="text" size="30" maxlength="15"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">最小起定量&nbsp;<font color="#FF0000">*</font></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_minorder"  type="text" size="30" maxlength="4">
              <SELECT name="p_minorder2">
                <OPTION value="">--请选择--</OPTION>
                <OPTION value="/台">/台</OPTION>
                <OPTION value="/粒">/粒</OPTION>
                <OPTION value="/座">/座</OPTION>
                <OPTION value="/辆">/辆</OPTION>
                <OPTION value="/只">/只</OPTION>
                <OPTION value="/支">/支</OPTION>
                <OPTION value="/枝">/枝</OPTION>
                <OPTION value="/架">/架</OPTION>
                <OPTION value="/头">/头</OPTION>
                <OPTION value="/张">/张</OPTION>
                <OPTION value="/块">/块</OPTION>
                <OPTION value="/片">/片</OPTION>
                <OPTION value="/匹">/匹</OPTION>
                <OPTION value="/件">/件</OPTION>
                <OPTION value="/根">/根</OPTION>
                <OPTION value="/条">/条</OPTION>
                <OPTION value="/把">/把</OPTION>
                <OPTION value="/卷">/卷</OPTION>
                <OPTION value="/副">/副</OPTION>
                <OPTION value="/幅">/幅</OPTION>
                <OPTION value="/双">/双</OPTION>
                <OPTION value="/一打">/一打</OPTION>
                <OPTION value="/份">/份</OPTION>
                <OPTION value="/套">/套</OPTION>
                <OPTION value="/棵">/棵</OPTION>
                <OPTION value="/箱">/箱</OPTION>
                <OPTION value="/袋">/袋</OPTION>
                <OPTION value="/盒">/盒</OPTION>
                <OPTION value="/包">/包</OPTION>
                <OPTION value="/捆">/捆</OPTION>
                <OPTION value="/筐">/筐</OPTION>
                <OPTION value="/瓶（罐）">/瓶（罐）</OPTION>
                <OPTION value="/毫米">/毫米</OPTION>
                <OPTION value="/厘米">/厘米</OPTION>
                <OPTION value="/米">/米</OPTION>
                <OPTION value="/千米">/千米</OPTION>
                <OPTION value="/英寸">/英寸</OPTION>
                <OPTION value="/英尺">/英尺</OPTION>
                <OPTION value="/加仑(英)">/加仑 (英)</OPTION>
                <OPTION value="/加仑(美)">/加仑 (美)</OPTION>
                <OPTION value="/克">/克</OPTION>
                <OPTION value="/千克">/千克</OPTION>
                <OPTION value="/磅">/磅</OPTION>
                <OPTION value="/公吨">/公吨</OPTION>
                <OPTION value="/吨(英)">/吨 (英)</OPTION>
                <OPTION value="/吨(美)">/吨 (美)</OPTION>
                <OPTION value="/毫升">/毫升</OPTION>
                <OPTION value="/公升">/公升</OPTION>
                <OPTION value="/盎司">/盎司</OPTION>
                <OPTION value="/夸脱">/夸脱</OPTION>
                <OPTION value="/品脱(英)">/品脱(英)</OPTION>
                <OPTION value="/品脱(美)">/品脱(美)</OPTION>
                <OPTION value="/码">/码</OPTION>
                <OPTION value="/平方英尺">/平方英尺</OPTION>
                <OPTION value="/平方英寸">/平方英寸</OPTION>
                <OPTION value="/平方米">/平方米</OPTION>
                <OPTION value="/平方码">/平方码</OPTION>
                <OPTION value="/立方米">/立方米</OPTION>
            </SELECT></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">付款方式</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="p_paytype" type="text"  size="30" maxlength="15"></TD>
          </TR>
		  
		  
	<?php 
		if($huiyuan)
		{
	?>	
		  
		  <tr>
		  	<td height="35" align="center" bgcolor="#EFF6FF">钻石会员推荐&nbsp;<font color="#FF0000">*</font></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;">
				<select name="zuanshi1" id="zuanshi1" style="width:160px;">
					<option value="qingxuanze">请选择</option>
					<option value="14">交通运输及配件</option>
					<option value="11">计算机及消费电子</option>
					<option value="13">机械设备、五金工具</option>
					<option value="4">农业</option>
					<option value="15">化工、矿产</option>
					<option value="8">建筑、装修、装潢</option>
					<option value="3">纺织、服饰</option>
					<option value="1">时尚礼品、饰品</option>
					<option value="7">家具装饰</option>
					<option value="9">医疗健康</option>
					<option value="12">电子电工</option>
					<option value="10">体育休闲用品</option>
					<option value="2">宠物与婴儿用品及玩具</option>
					<option value="5">广告、办公、包装用品</option>
					<option value="6">家居与园艺</option>
				</select>
				<select name="zuanshi2" id="zuanshi2" style="width:160px;">
					<option value="qingxuanze" >请选择</option>
				</select>
				<select name="zuanshi2n" id="zuanshi2n" style="display:none">
					<?php
						$c2 = mysql_query("select id,hot_name,hot_ping,hot_id from hot_product where hot_id=0" );
						while($r2 = mysql_fetch_array($c2))
						{
					?>
					<option value="<?=$r2['id']?>" attr="<?=$r2['hot_ping']?>"><?=$r2['hot_name']?></option>
					<?php
						}
					?>
				</select>
				<select name="zuanshi3" id="zuanshi3" style="width:160px;">
					<option value="qingxuanze">请选择</option>
				</select>
				<select name="zuanshi3n" id="zuanshi3n" style="display:none">
					<?php
						$c3 = mysql_query("select id,hot_name,hot_ping,hot_id from hot_product where not hot_id=0" );
						while($r3 = mysql_fetch_array($c3))
						{
					?>
					<option value="<?=$r3['id']?>" attr="<?=$r3['hot_id']?>"><?=$r3['hot_name']?></option>
					<?php
						}
					?>
				</select>
				<span style="color:red">选择后优先推荐</span>
			</TD>
		  </tr>
	<?php } ?>	  
		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">&nbsp;</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input type="submit" value="提交">
        <INPUT type="hidden" value="sdi2012" name="act_t2j"></TD>
          </TR>
 </form>                
</TABLE>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");
?>
</div>
</body>
</html>
<script language="javascript">
$(function()
{
	$("#zuanshi1").change(function()
	{
		$("#zuanshi2").empty();
		$("#zuanshi2").append('<option value="qingxuanze">请选择</option>');
		$("#zuanshi1 option").each(function()
		{
			if($(this).attr("selected"))
			{
				var v = $(this).val();
				if(v!="qingxuanze")
				{
					$("#zuanshi2n option").each(function()
					{
						if($(this).attr("attr")==v)
						{
							$("#zuanshi2").append($(this).clone());
						}
					});
				}
			}
		}
		);
	}
	);

	$("#zuanshi2").change(function()
	{
		$("#zuanshi3").empty();
		$("#zuanshi3").append('<option value="qingxuanze">请选择</option>');
		$("#zuanshi2 option").each(function()
		{
			if($(this).attr("selected"))
			{
				var v = $(this).val();
				if(v!="qingxuanze")
				{
					$("#zuanshi3n option").each(function()
					{
						if($(this).attr("attr")==v)
						{
							$("#zuanshi3").append($(this).clone());
						}
					});
				}
			}
		}
		);
	}
	);
	
	$("#form1").submit(function()
	{
		t=$("#p_title").val();
		t=trim(t);
		if(t.length<3)
		{
			alert('产品至少输入3个汉字');
		    $("#p_title").focus();
		    return false;
		}
	
	   if($("#catalog_1").val()==""){
		  alert("请选择产品目录");
		  $("#catalog_1").focus();
		  return false;
	   }
	   if($("#catalog_2").val()==""){
		  alert("请选择二级目录");
		  $("#catalog_2").focus();
		  return false;
	   }
	
	   if($("#p_list").val()==""){
		  alert("请选择产品分类");
		  $("#p_list").focus();
		  return false;
	   }   
	   if($("#p_keyword").val()==""){
		  alert("产品关键字不能为空");
		  $("#p_keyword").focus();
		  return false;
	   }   
	   if($("#p_info").val()==""){
		  alert("产品描述不能为空");
		  $("#p_info").focus();
		  return false;
	   }   
		if($("#p_guige").val()==""){
		  alert("产品规格不能为空");
		  $("#p_guige").focus();
		  return false;
	   }   
		if($("#p_minorder").val()==""){
		  alert("最小起订量不能为空");
		  $("#p_minorder").focus();
		  return false;
	   }
		if($("#p_minorder2").val()==""){
		  alert("单位不能为空");
		  $("#p_minorder2").focus();
		  return false;
	   }
	   if($("#zuanshi1").length==1)
	   {
	   	  if($("#zuanshi1 option:selected").val()=="qingxuanze")
		  {
		  	alert("请选择钻石会员推荐，我们将为您的产品优先推荐") ;
			$("#zuanshi1").focus();
		  	return false;
		  }
	   	  if($("#zuanshi2 option:selected").val()=="qingxuanze")
		  {
		  	alert("请选择钻石会员推荐，我们将为您的产品优先推荐") ;
			$("#zuanshi2").focus();
		  	return false;
		  }	
		  if($("#zuanshi3 option:selected").val()=="qingxuanze")
		  {
		  	alert("请选择钻石会员推荐，我们将为您的产品优先推荐") ;
			$("#zuanshi3").focus();
		  	return false;
		  }
	   }   
	});    
});

function trim(str)
{
     return str.replace(/\s/g,'');
}

</script>